import java.util.Scanner;

public class Main1 {
    public static void main1(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String s = scanner.nextLine();

        Solution1 solution = new Solution1();
        System.out.println(solution.hasSameDigits(s));
    }
}

class Solution1 {
    public boolean hasSameDigits(String s) {
        int n = s.length();
        int[][] res = new int[n][n];
        char[] array = s.toCharArray();

        for (int i = 0; i < n; i++) {
            res[0][i] = array[i] - '0';
        }

        for (int i = 1; i < n; i++) {
            for (int j = n - i - 1; j >= 0; j--) {
                res[i][j] = (res[i -1][j] + res[i -1][j+1]) %10;
            }
        }

        return res[n - 2][0] == res[n - 2][1];
    }
}